import pandas as pd
from sklearn import model_selection

from config import KFOLD_N


df = pd.read_csv('../input/train_clear.csv')
df['kfold'] = -1
df.sample(frac=1).reset_index(drop=True)

kf = model_selection.KFold(n_splits=KFOLD_N)

for fold, (t, v) in enumerate(kf.split(X=df)):
    df.loc[v, 'kfold'] = fold

df.to_csv('../input/train_folds.csv', index=False)
print("Successfully created xx_fold.csv")